﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FDEE.Model
{
    public static class RebarArrangement
    {
        /// <summary>
        /// 钢筋均布法
        /// </summary>
        /// <param name="v1">均布总距离，中到中</param>
        /// <param name="v2">均布距离</param>
        /// <returns></returns>
        internal static int EqualArr(double v1, double v2,bool isContain=true)
        {
            double v = v1 / v2;
            if (!isContain)
            {
                if ((v - (int)v) < 0.5)
                {
                    return (int)v + 1;
                }
                else
                {
                    return (int)Math.Round(v1 / v2, 0, MidpointRounding.AwayFromZero) + 1;
                }
            }
            else
                return (int)Math.Round(v1 / v2, 0, MidpointRounding.AwayFromZero) + 1;
        }
    }
}
